<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml" 
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:pe="http://primefaces.org/ui/extensions"
                xmlns:hr="http://java.sun.com/jsf/composite/autocomplete">

    <ui:define name="content">
        <h:form>
            <p:selectOneMenu id="advanced" 
                             value="#{salaryCycleController.current}" 
                             converter="salaryCycleConverter" 
                             effect="fade" var="t" 
                             filter="true" 
                             filterMatchMode="startsWith">

                <f:selectItems value="#{salaryCycleController.salaryCycles}" 
                               var="theme" 
                               itemLabel="#{theme.name}" 
                               itemValue="#{theme}" ></f:selectItems>

                <p:column style="width:10%" headerText="Name">
                    <h:outputText value="#{t.name}" />
                </p:column>

                <p:column headerText="Year">
                    <h:outputText value="#{t.salaryYear}" />
                </p:column>
                <p:column headerText="Month">
                    <h:outputText value="#{t.salaryMonth}" />
                </p:column>
            </p:selectOneMenu>
            <br></br>
            <h:panelGrid columns="3">
                <p:commandButton value="Process" ajax="false" action="#{salaryCycleController.fillStaffSalary()}" ></p:commandButton>
                <p:commandButton value="Print" ajax="false" action="#" >
                    <p:printer target="gpBillPreview" ></p:printer>
                </p:commandButton>
                <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" onclick="onSubmitButton();" >
                    <pe:exporter type="xlsx" target="tbl" fileName="all_staff_salary_summery"  />
                </p:commandButton>
            </h:panelGrid>

            <p:panel id="gpBillPreview" styleClass="noBorder summeryBorder">
            <p:dataTable id="tbl" value="#{salaryCycleController.staffSalary}" var="scc" >
                <f:facet name="header">
                    <h:outputLabel value="#{sessionController.loggedUser.institution.name}" /><br></br>
                    <h:outputLabel value="All Staff Salary Summary"></h:outputLabel><br></br>
                    <h:outputLabel value="#{salaryCycleController.current.name}"></h:outputLabel>
                </f:facet>


                <p:column headerText="Name" >
                    <f:facet name="header">
                        <h:outputLabel value="Name"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.staff.person.nameWithTitle}"></h:outputLabel>                    
                </p:column>

                <p:column headerText="Department" >
                    <f:facet name="header">
                        <h:outputLabel value="Department"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.staff.department.name}" ></h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel value="Total"></h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Basic" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Basic"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.basicValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.basicValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Over Time" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Over Time"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.overTimeValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;"
                                       value="#{salaryCycleController.overTimeValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Extra Duty Value" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Extra Duty Value"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.transExtraDutyValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.extraDutyValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="No Pay" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="No Pay"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.noPayValueBasic+scc.noPayValueAllowance}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.noPayValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Holiday Allowance" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Holiday Allowance"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.merchantileAllowanceValue+scc.poyaAllowanceValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.holyDayAllowancesTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Day Off Allownace" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Day Off Allownace"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.dayOffAllowance+scc.sleepingDayAllowance}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.dayOffValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Additional Componnet" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Additional Componnet"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.componentValueAddition}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;"
                                       value="#{salaryCycleController.additionalComponentTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Deductional Componnet" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Deductional Componnet"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.componentValueSubstraction}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.deductionalComponentTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Adjustment To Basic" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Adjustment To Basic"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.adjustmentToBasic}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;"
                                       value="#{salaryCycleController.adjustmentToBasicTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="Adjustment To Allowance" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="Adjustment To Allowance"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.adjustmentToAllowance}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;"
                                       value="#{salaryCycleController.adjustmentToAllowancesTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="EPF Staff" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="EPF Staff"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.epfStaffValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.epfStaffValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="EPF Company" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="EPF Company"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.epfCompanyValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.epfCompanyValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="ETF Satff" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="ETF Satff"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.etfSatffValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.etfStaffValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>

                <p:column headerText="ETF Company" styleClass="averageNumericColumn">
                    <f:facet name="header">
                        <h:outputLabel value="ETF Company"></h:outputLabel>
                    </f:facet>
                    <h:outputLabel value="#{scc.etfCompanyValue}" >
                        <f:convertNumber pattern="0.00" />
                    </h:outputLabel>
                    <f:facet name="footer">
                        <h:outputLabel style="text-align: right;" 
                                       value="#{salaryCycleController.etfCompanValueTotal}">
                            <f:convertNumber pattern="#,##0.00" />
                        </h:outputLabel>
                    </f:facet>
                </p:column>
                <f:facet name="footer">
                    <p:outputLabel value="Print By : #{sessionController.loggedUser.webUserPerson.name} - " />
                    <p:outputLabel value="Print At : " />
                    <p:outputLabel value="#{commonController.currentDateTime}" >
                        <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a " />
                    </p:outputLabel>
                </f:facet>

            </p:dataTable>

</p:panel>
        </h:form>        
    </ui:define>

</ui:composition>
